1. Field of the Invention
The present invention relates to a computer system, and deals more particularly with a method, system, and computer-readable code for dynamically determining the most appropriate location (whether on a server and/or Web proxy, or on a client) for applying style sheets. Furthermore, the present invention enables style sheet applicability to be increased.
2. Description of the Related Art
A xe2x80x9cstyle sheetxe2x80x9d is a specification of a style that is to be used when presenting a document. The style specification includes information such as the font and margins to be used, the formatting layout, and other types of information that indicate how the presented document should appear. Style sheets can be used for many types of presentation of a document, including printing the document, displaying it on a video display, processing the document by a speech synthesizer, etc. Consequently, style sheets may also be utilized to describe transformations from one document type to another (e.g. from MathML to HTML) or as filters which describe transformations to reduce the amount of content while maintaining the original document type.
One type of style sheet is an XSL Style Sheet. XSL Style Sheets are style sheets specified in XSL, which is a particular style sheet language. xe2x80x9cXSLxe2x80x9d is an acronym for xe2x80x9cExtensible Stylesheet Languagexe2x80x9d. An XSL Style Sheet specifies how an XML document is to be transformed for presentation, resulting in a different document which may or may not maintain the original document type. xe2x80x9cXMLxe2x80x9d is an acronym for xe2x80x9cExtensible Markup Language. XML is a standardized formatting notation, created for structured document interchange on the World Wide Web (hereinafter, xe2x80x9cWebxe2x80x9d). (Refer to xe2x80x9cExtensible Markup Language (XML), W3C Recommendation Feb. 10, 1998xe2x80x9d which is available on the World Wide Web at http://www.w3.org/TR/1998/REC-xml-19980210, for more information on XML; and to xe2x80x9cExtensible Stylesheet Language (XSL), Version 1.0, World Wide Web Consortium Working Draft Dec. 16, 1998xe2x80x9d, hereinafter xe2x80x9cXSL Specificationxe2x80x9d, which is available on the Web at http://www.w3.org/TR/WD-xsl, for more information on XSL.)
Style sheets include xe2x80x9ctemplate rulexe2x80x9d constructs, which define an input pattern and a template (also known as an xe2x80x9cactionxe2x80x9d) to use in creating an output result tree fragment. When applying a style sheet, the patterns in the templates are matched against the syntax of the source document. When a match is found with the template pattern, an output document fragment is created according to the actions specified in the template (which may include processing additional elements in the source document beyond the matching element). The source document is parsed recursively, until no more matching patterns are found. The resulting document fragments are then aggregated to yield a complete output document. (For more information on this process, refer to section 2, xe2x80x9cTree Constructionxe2x80x9d, in the XSL Specification.) It is this template matching and substitution of different document elements according to the actions in the matching rules that enables style sheets to transform documents.
(While the term xe2x80x9cdocumentxe2x80x9d is used herein when discussing encoded data and application of style sheets thereto, it is to be understood that the information on which a style sheet operates may represent any type of information, and is not limited to the traditional interpretation of the word xe2x80x9cdocumentxe2x80x9d. As one example, a style sheet may be used to process an encoded representation of records from a data repository which specify a company""s sales data. As another example, a style sheet may be used to format employee information retrieved from a corporate database for presentation. For ease of reference, the term xe2x80x9cdocumentxe2x80x9d will be used herein to refer to these diverse types of information.)
XML is emerging as a powerful methodology for representing document content, due to its ability to store data in a self-defining, portable manner. Style sheet languages such as XSL, along with their associated processors, are powerful tools for filtering data content encoded in notations such as XML, as well as for transforming documents encoded in one markup language into other markup languages such as HTML (HyperText Markup Language) or WML (Wireless Markup Language). Because of these features, style sheets have tremendous potential to aid in the process of transcoding data content. xe2x80x9cTranscodingxe2x80x9d refers to a process by which data content is transformed. A content-reducing xe2x80x9ctranscoding filterxe2x80x9d may be applied to a file, to reduce the file size. Transcoding filters are software applications that algorithmically reduce the number of bits used to represent information while still retaining its essential content. Such filters are known in the art. For example, a transcoding filter can be applied to an image that was rendered using 256 colors (also known as xe2x80x9c8-bit colorxe2x80x9d), to create a simpler version of the same image which uses only 16 colors. Or, the image could be converted to grayscale using a different transcoding filter. This type of filtering process greatly reduces the number of bytes in the resulting file.
One environment in which this type of content-reducing transcoding process is becoming quite important is with computing devices connected to a network using relatively expensive wireless connections which may have limited bandwidth, and/or with pervasive computing devices. Pervasive computing devices are typically small, constrained-storage devices such as xe2x80x9cSmart Phonesxe2x80x9d or the WorkPad device from the International Business Machines Corporation (IBM). (xe2x80x9cWorkPadxe2x80x9d is a registered trademark of IBM.) Before sending data from a server to a constrained-storage device, or over a limited bandwidth connection, it may be beneficial to reduce the size of the data. The smaller file can then be transmitted more quickly and at less cost, and it is more likely that sufficient storage space will be available for receiving the file (and subsequently processing it) on the device.
Filtering style sheets may be considered a type of content-reducing transcoding filter. In addition to using style sheets for content reduction, style sheets that transform file content from one form to another may also be considered transcoding filters. This type of transcoding process may be beneficial in the wireless environment and with pervasive computing devices, and in any other environment where it is desirable to transform a file from one format into another. For example, a document encoded in a data file may not include any images or video files (and therefore might not benefit significantly from a reduction in size), but it may be desirable to transmit this document from a server to a handheld device. If the document is encoded in one markup language, such as XML, while the device is only capable of supporting a different markup language such as WML or WBXML (xe2x80x9cWireless Application Protocol Binary XMLxe2x80x9d), then a transcoding process needs to be performed. An appropriate transforming style sheet may be used to perform this process.
Some significant problems associated with using style sheets for transcoding have been addressed. The first related invention, xe2x80x9cAchieving Complex Transformations with Dynamic Style Sheet Coalescingxe2x80x9d, discloses a novel technique for dynamically determining one or more transformations that may be used to transform an input document in a first notation into a document in a different notation, where the output notation is tailored to (among other things) the target environment where the document will be rendered for presentation. The second related invention, xe2x80x9cRetrieval of Style Sheets from Directories Based Upon Partial Characteristic Matchingxe2x80x9d, discloses a novel technique for retrieving style sheets from a directory or other repository, based upon a pattern-matching process which uses the characteristics of the style sheets. However, a number of areas remain which need to be addressed in order for style sheets to be used optimally for transcoding purposes.
One issue that remains with using style sheets for transcoding is the difference in capabilities among different types of end-user devices. Some devices are capable of supporting style sheet processors (for example, using browsers which contain or invoke style sheet processors), while other devices are not. Thus, it would be beneficial for a transcoding process or framework operating on a server to be able to off-load the style sheet processing to the end-user device when the device is capable of applying the style sheet directly; otherwise, the style sheet application must be performed on the server before transmitting the resulting document to the device.
A second issue that remains with using style sheets for transcoding is that, in some cases, an appropriate style sheet for transforming a document for a particular end-user device is not available. Style sheets (and style sheet processors) may be developed independently by software vendors, in-house programmers, etc., supporting a wide variety of transformations (and style sheet languages, respectively). For example, a style sheet may be created that is tailored to presenting the content of a specific document or data file, similar to the manner in which report-generating software programs operate on data files. Thus, the style sheets that are available in one computing environment may be quite different from those in another computing environment, and the selection available within an environment may change over time. Or, a new device type may appear on the market, for which no device-specific style sheets are yet available. Similarly, new markup languages may be written, and for some period of time there may be no style sheets available for transforming documents into the new language.
A related issue occurs when style sheets are dynamically selected using an end-user""s preferences (such as may be stored in a directory or other repository). For example, a user preference may specify that all documents are to be presented using large fonts, or avoiding specific colors on a display, or using a voice synthesizer. A style sheet selected using user preference as the selection criteria may generate content that is not tailored for the particular end-user device.
Accordingly, a need exists for a technique by which the problems discussed above for using style sheets for transcoding can be addressed. The present invention provides a technique for dynamically determining the most appropriate location to apply style sheets, whether that location is the client device, the server, or some combination thereof. Furthermore, the present invention provides a technique for increasing the applicability of style sheets when a style sheet tailored to a particular target environment is not readily available.
An object of the present invention is to provide a technique for dynamically determining the most appropriate location to apply style sheets, whether that location is the client device, the server, or some combination thereof.
Another object of the present invention is to provide a technique for increasing the applicability of style sheets when a style sheet tailored to a particular target environment is not readily available.
Other objects and advantages of the present invention will be set forth in part in the description and in the drawings which follow and, in part, will be obvious from the description or may be learned by practice of the invention.
To achieve the foregoing objects, and in accordance with the purpose of the invention as broadly described herein, the present invention provides a method, system, and computer-readable code for use in a computing environment capable of having a connection to a network, for dynamically determining the most appropriate location to apply style sheets. The technique comprises: selecting one or more style sheets to transform a particular input document; determining whether a client device is capable of applying the selected style sheets; applying the selected style sheets at the client device when the determining has a positive result; and applying the selected style sheets at a server when the determining has a negative result. The determining may determine a first subset of the selected style sheets that the client device is capable of applying, and a second subset that the client device is not capable of applying. In that case, the applying at the client step applies the first subset, and the applying at the server step applies the to second subset.
In one aspect, when the determining has a positive result, the technique may further comprise: caching the selected style sheets at the server; modifying the input document to refer to the cached style sheets; and sending the modified input document to the client. When the determining has a negative result, the technique may further comprise: sending the input document to the client following completion of the applying at the server. In another aspect, when the determining step has a positive result, the technique further comprises: caching the selected style sheets at the server; modifying the input document to refer to the cached style sheets; trimming the modified input document using a style sheet preprocessor; and sending the trimmed input document to the client. In this aspect, when the determining has a negative result, the technique further comprises sending the input document to the client following completion of the applying at the server.
In yet another aspect, the technique may further comprise: first determining whether one or more of the selected style sheets requires resolution of variable factors; and second determining whether the client is capable of resolving the variable factors when the first determining has a positive result. When the second determining has a positive result, the technique further comprises: caching the selected style sheets at the server; modifying the input document to refer to the cached style sheets; and sending the modified input document to the client. When the second determining has a negative result, the technique further comprises: translating the style sheets at the server to resolve the variable factors; caching the translated style sheets at the server; and modifying the input document to refer to the cached translated style sheets. In addition, the technique further comprises sending the modified input document to the client.
The input document may be encoded in Extensible Markup Language (XML). The style sheets may be encoded in a style sheet language such as Extensible Stylesheet Language (XSL), Cascading Style Sheet Language (CSS), or Document Style Semantics and Specification Language (DSSSL).
The present invention will now be described with reference to the following drawings, in which like reference numbers denote the same element throughout.